package com.masterrabbit.sn.controller;

import com.masterrabbit.common.core.web.domain.AjaxResult;
import com.masterrabbit.sn.domain.RepairRecords;
import com.masterrabbit.sn.service.RepairRecordsService;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/repairRecords")
public class RepairRecordsController {
    @Autowired
    private RepairRecordsService repairRecordsService;
    @GetMapping("/getRepairRecords/{userId}")
    public AjaxResult getRepairRecords(@PathVariable int userId,
                                       @RequestParam(defaultValue = "7") int pageSize,
                                       @RequestParam(defaultValue = "1") int pageNo) {
        return AjaxResult.success(repairRecordsService.getRepairRecords(pageNo, pageSize, userId));
    }
    /**
     * 查询维修记录详情
     */
    @GetMapping("/getRepairRecordsDetails/{repairRecordsId}")
    public AjaxResult getRepairRecordsDetails(@PathVariable int repairRecordsId) {
        return AjaxResult.success(repairRecordsService.getById(repairRecordsId));
    }
}
